﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <style type="text/css">
        textarea
        {
            width: 90%;
            height: 150px;
        }
    </style>
    <script src="../../fly.js" type="text/javascript"></script>
    <script type="text/javascript">
    
    </script>
</head>
<body>
    <button>Run</button>
    <table border="1" cellpadding="0" cellspacing="0" style="height: 123px; width: 288px">
        <col style='display0: none' />
        <col style='color: blue' />
        <col style='color: black' />
        <tr>
            <td>
                1
            </td>
            <td colspan="2">
                2 3
            </td>
        </tr>
        <tr>
            <td rowspan="2">
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
            </td>
            <td colspan="2" rowspan="2">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
            </td>
        </tr>
    </table>
    <script type="text/javascript">
        //        var colWidths = $("col").select('o=>o.offsetWidth');
        //        var left = 0;
        //        var colLefts = colWidths.select(function () {
        //            left += this;
        //            return left;
        //        })
        //        cells.each(function () {
        //            for (var i = 0; i < colLefts.length; i++) {
        //                if (this.offsetLeft < colLefts[i]) {
        //                    this.innerText=i
        //                    break
        //                }
        //            }
        //        });
        $("button").click(function () {
            //debugger
            var cells = $("td");
            var groups = cells.group("o=>o.offsetLeft").order("o=>o.key").each(function (g, gi) {
                for (var i = 0; i < g.length; i++)
                    g[i].innerText = gi;
            })

            return false;
        });
    </script>
</body>
</html>
